package com.twu.biblioteca.instruction;

import com.google.common.collect.ImmutableList;
import com.twu.biblioteca.UserCenter;

import java.util.List;

public class InstructionFactory {
    public static List<Instruction> getAllInstructions() {
        return UserCenter.getInstance().haveLogin() ? getLoginInstructions() : getUnloginInstructions();
    }

    private static List<Instruction> getLoginInstructions() {
        return ImmutableList.of(
                new ListBooksInstruction(),
                new ListMenuOptionInstruction(),
                new ListMoviesInstruction(),
                new LoginInstruction(),
                new MembershipInstruction(),
                new QuitInstruction(),
                new ReserveInstruction()
        );
    }

    private static List<Instruction> getUnloginInstructions() {
        return ImmutableList.of(
                new ListBooksInstruction(),
                new ListMenuOptionInstruction(),
                new ListMoviesInstruction(),
                new LoginInstruction(),
                new MembershipInstruction(),
                new QuitInstruction()
        );
    }
}
